﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace HeroAttack
{
    public abstract class Hero
    {
        protected IAttack attack;
        protected IRole role;

        // 实现攻击
        public void Attack()
        {
            Console.WriteLine($"角色：{role.GetRoleName()}");
            attack.Attack();
        }

        //设置英雄的攻击和名称
        public void SetHero(IAttack attack, IRole role)
        {
            this.attack = attack;
            this.role = role;
        }

        public abstract void Display();
    }
}
